#ifndef __DATA_H__
#define __DATA_H__

#include <stdio.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <math.h>

#define header_size 4096   /* dada header has 4096 bytes */

/* generate coeffs for pfb */
void gen_coeffs(int ntap,int nfft,double *coeffs);

/* expand the coefficients to those of opfb */
void opfb_coeffs(double *coeffs,double *ocoeffs,int ntap,int nfft);

/* load pfb coeffs */
void load_coeffs(const char *filename,int ntap,int nfft,double *coeffs);

/* load data */
FILE *load_data(const char *filename);

/* expand the input data for opfb */
void opfb_data(double *data,double *odata,double *half_data,int nfft,long block_size);

/* flip up and down */
void flip_data(double *odata,int nfft,long size);

/* get file length */
long long get_file_length(const char *file_name);

/* unpack caspsr backend data */
void unpack_dada(FILE *pf,double *pol_x,double *pol_y,long size);

/* write data to file */
void write_data(const char *filename,double *data,long size);

#endif